<include file="Core:Public:header" /> {:W('Navigation')}
<div class="body-right">
	<div class="row-table">
		<div class="row-table-title">添加每日配送员数据</div>
		<div class="row-table-body">
			<form class="form-horizontal " action="{:U('chrm/count/upload')}" method="post" enctype="multipart/form-data">
				<p class="form-title">添加每日配送员数据 &nbsp;&nbsp;<a href="javascript:history.go(-1);">返回</a></p>
				<div class="form-group">
					<label for="name" class="col-sm-2 control-label">外卖单状态</label>
					<div class="col-sm-5">
						<input type="file" class="btn btn-info" name="excel" onchange="getPhotoSize(this)"/>
						<p class="help-block">上传“每日团队配送员数据”<span class="color-red">文件大小不得超过5M</span></p>
					</div>
				</div>

				<div class="form-group">
					<label for="name" class="col-sm-2 control-label">操作人</label>
					<div class="col-sm-3">
						<input class="form-control" type="text" readonly="true" value="{:session('name')}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-3">
						<input name="submit" class="btn btn-primary" type="submit" value="提交" />&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="button" class="btn" value="取消" onclick="javascript:history.go(-1);" />
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
<script>
	//判断文件大小
	function getPhotoSize(obj) {
		photoExt = obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase(); //获得文件后缀名
//		alert(photoExt);
		if (photoExt != '.xlsx' or photoExt != '.xls') {
			alert("请上传后缀名为xlsx或xls的EXCEL文件!");
			return false;
		}
		var fileSize = 0;
		var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
		if (isIE && !obj.files) {
			var filePath = obj.value;
			var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
			var file = fileSystem.GetFile(filePath);
			fileSize = file.Size;
		} else {
			fileSize = obj.files[0].size;
		}
		fileSize = Math.round(fileSize / 1024 * 100) / 100; //单位为KB
		if (fileSize >= 20480) {
			alert("文件不得大于20M，请重新上传!");
			return false;
		}
	}
</script>
<include file="Core:Public:alert" />
<include file="Core:Public:footer" />